<template>
  <view class="goods-list">
    <view
      class="goods-item mb-20rpx df"
      v-for="item in goodsList"
      :key="item.id"
      @click="goDetail(item)"
    >
      <view class="goods-pic">
        <up-image
          :show-loading="true"
          :src="item.pictUrl"
          width="150rpx"
          height="150rpx"
          radius="10"
        ></up-image>
      </view>
      <view class="goods-info df-jsb fd-c ml20">
        <view class="title txt-cut">
          {{ item.goodsName || item.title || item.shortTitle }}</view
        >
        <view class="price color-theme bold">￥{{ item.minPrice }}</view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref, onMounted } from "vue";

// 定义组件属性
const props = defineProps({
  goodsList: {
    type: Array,
    default: [],
  },
});
function goDetail(item) {
  uni.navigateTo({
    url: `/pages/goods/detail?goodsId=${item.id}`,
  });
}
</script>

<style lang="scss" scoped>
.goods-list {
  .goods-item {
    // width: 150rpx;
  }
}
</style>
